angular.module('register', []).controller('registerController', function ($scope) {
    $scope.userdata = {};
    $scope.usersubmit = function () {
        console.log($scope.userdata);
        if ($scope.regsubmit.$invalid) {
            alert("请检查您的信息")
        } else {
            alert("成功")
        }
    }

})
    .directive('compare', function () {
        console.log(1)
        var o = {};
        o.strict = 'AE';
        o.scope = {
            orgText: '=compare'
        };
        o.require = 'ngModel';
        o.click = function (sco, ele, att, con) {
            con.$validators.compare = function (v) {
                return v = sco.orgText;
            };
            sco.$watch('orgText', function () {
                con.$validate();
            })
        };

        return o;
    });